package com.ecp.crm.bean;

import java.util.Date;

import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import org.codehaus.jackson.map.annotate.JsonRootName;

import com.ecp.commons.annotation.VariantType;
import com.ecp.commons.serialization.GenericBean;
import com.ecp.commons.serialization.SerializableObject;
import com.ecp.commons.serialization.Variant;
import com.rolmex.data.exchange.util.JsonWrapper;

@JsonRootName(value = "User")
@JsonIgnoreProperties(value = { "bShop", "reason", "gameid", "gametype", "roomid", "channel", "taskId", "lastLoginTime" })
public class User extends GenericBean implements SerializableObject {
	public static final Integer	ISUSABLE_ROLMEX_OLD	= 100;		//罗麦会员旧数据
	public static final Integer	ISUSABLE_ROLMEX_NEW	= 101;		//罗麦会员新对接数据

	private boolean				bShop				= false;

	/**游戏对接会员临时存储字段**/
	private String				reason;
	private String				gameid;
	private String				gametype;
	private String				roomid;
	private String				channel;
	private String				taskId;

	private Date				lastLoginTime;

	/**OA续约到期时间**/
	private String				expireTime;

	@Override
	public void defineVariantSet() {
		entity = "crm_user";
		map.put("id", new Variant(VariantType.INTEGER, false, 0, null, true, true, true));
		map.put("loginId", new Variant(VariantType.STRING, false, 64, null, false, true, true));
		map.put("password", new Variant(VariantType.STRING, false, 64, "passwordHash", false, true, true));
		map.put("realName", new Variant(VariantType.STRING, false, 128, null, false, true, true));
		map.put("title", new Variant(VariantType.STRING, false, 128, null, false, true, true));
		map.put("birthday", new Variant(VariantType.STRING, false, 64, null, false, true, true));
		map.put("emoneyExt", new Variant(VariantType.DOUBLE, true, 0, null, false, true, true));
		map.put("random", new Variant(VariantType.STRING, true, 32, null, false, true, true));
		map.put("homeAddress", new Variant(VariantType.STRING, false, 128, null, false, true, true));
		map.put("postalCode", new Variant(VariantType.STRING, false, 128, null, false, true, true));
		map.put("email", new Variant(VariantType.STRING, true, 128, null, false, true, true));
		map.put("honorID", new Variant(VariantType.INTEGER, true, 0, null, false, true, true));
		map.put("gender", new Variant(VariantType.INTEGER, false, 0, null, false, true, true));
		map.put("isUsable", new Variant(VariantType.INTEGER, false, 0, null, false, true, true));
		map.put("isAdmin", new Variant(VariantType.INTEGER, false, 0, null, false, true, true));
		map.put("regionId", new Variant(VariantType.INTEGER, true, 0, null, false, true, true));
		map.put("userEPoint", new Variant(VariantType.INTEGER, true, 0, null, false, true, true));
		map.put("parentId", new Variant(VariantType.INTEGER, true, 0, null, false, true, true));
		map.put("departmentId", new Variant(VariantType.INTEGER, true, 11, null, false, true, true));
		map.put("emoney", new Variant(VariantType.INTEGER, true, 0, null, false, true, true));
		map.put("mobilePhone", new Variant(VariantType.STRING, false, 128, null, false, true, true));
		map.put("homePhone", new Variant(VariantType.STRING, false, 128, null, false, true, true));
		map.put("officePhone", new Variant(VariantType.STRING, false, 128, null, false, true, true));
		map.put("city", new Variant(VariantType.STRING, false, 1024, null, false, true, true));
		map.put("province", new Variant(VariantType.STRING, false, 1024, null, false, true, true));
		map.put("createDate", new Variant(VariantType.DATETIME, true, 0, null, false, true, true));
		map.put("lastModifiedDate", new Variant(VariantType.DATETIME, true, 0, null, false, true, true));
		map.put("lastModifiedParentTime", new Variant(VariantType.DATETIME, true, 0, null, false, true, true));
		map.put("mId", new Variant(VariantType.INTEGER, true, 1, null, false, true, true));
		map.put("deposit", new Variant(VariantType.DOUBLE, true, 0, null, false, true, true));
		map.put("shopDeposit", new Variant(VariantType.DOUBLE, true, 0, null, false, true, true));
		map.put("special", new Variant(VariantType.STRING, true, 10, null, false, true, true));
		map.put("goldParentId", new Variant(VariantType.INTEGER, true, 10, null, false, true, true));
		map.put("lastModifiedGoldParentTime", new Variant(VariantType.DATETIME, true, 0, null, false, true, true));
		map.put("relaId", new Variant(VariantType.INTEGER, true, 0, null, false, true, true));
		map.put("teamId", new Variant(VariantType.INTEGER, true, 0, null, false, true, true));
	}

	@Override
	public void resetValues() {
		this.set("id", 0);
		this.set("loginId", "");
		this.set("password", "");
		this.set("realName", "");
		this.set("title", "");
		this.set("birthday", "");
		this.set("emoneyExt", "0");
		this.set("homeAddress", "");
		this.set("postalCode", "");
		this.set("email", "");
		this.set("honorID", 0);
		this.set("gender", 0);
		this.set("userEPoint", 0);
		this.set("parentId", 0);
		this.set("departmentId", 0);
		this.set("isUsable", 1);
		this.set("isAdmin", 0);
		this.set("regionId", 0);
		this.set("emoney", 0L);
		this.set("mobilePhone", "");
		this.set("homePhone", "");
		this.set("officePhone", "");
		this.set("city", "");
		this.set("province", "");
		this.set("createDate", "");
		this.set("lastModifiedDate", "");
		this.set("lastModifiedParentTime", "");
		this.set("mId", 0);
		this.set("deposit", 0.0);
		this.set("shopDeposit", 0.0);
		this.set("special", "");
		this.set("goldParentId", "");
		this.set("lastModifiedParentTime", "");
		this.set("relaId", 0);
		this.set("teamId", 0);
	}

	public int getTeamId() {
		return this.getInt("teamId");
	}

	public void setTeamId(int teamId) {
		this.set("teamId", teamId);
	}

	public String getTaskId() {
		return taskId;
	}

	public void setTaskId(String taskId) {
		this.taskId = taskId;
	}

	public String getReason() {
		return reason;
	}

	public void setReason(String reason) {
		this.reason = reason;
	}

	public String getGameid() {
		return gameid;
	}

	public void setGameid(String gameid) {
		this.gameid = gameid;
	}

	public String getGametype() {
		return gametype;
	}

	public void setGametype(String gametype) {
		this.gametype = gametype;
	}

	public String getRoomid() {
		return roomid;
	}

	public void setRoomid(String roomid) {
		this.roomid = roomid;
	}

	public String getChannel() {
		return channel;
	}

	public void setChannel(String channel) {
		this.channel = channel;
	}

	public Date getLastModifiedParentTime() {
		return this.getDate("lastModifiedParentTime");
	}

	public void setLastModifiedParentTime(Date lastModifiedParentTime) {
		this.set("lastModifiedParentTime", lastModifiedParentTime);
	}

	public Date getLastModifiedGoldParentTime() {
		return this.getDate("lastModifiedGoldParentTime");
	}

	public void setLastModifiedGoldParentTime(Date lastModifiedGoldParentTime) {
		this.set("lastModifiedGoldParentTime", lastModifiedGoldParentTime);
	}

	public int getGoldParentId() {
		return this.getInt("goldParentId");
	}

	public void setGoldParentId(int goldParentId) {
		this.set("goldParentId", goldParentId);
	}

	public int getRelaId() {
		return this.getInt("relaId");
	}

	public void setRelaId(int relaId) {
		this.set("relaId", relaId);
	}

	public int getId() {
		return this.getInt("id");
	}

	public void setId(int id) {
		this.set("id", id);
	}

	public int getMId() {
		return this.getInt("mId");
	}

	public void setMId(int mId) {
		this.set("mId", mId);
	}

	public String getLoginId() {
		return this.getString("loginId");
	}

	public void setLoginId(String loginId) {
		this.set("loginId", loginId);
	}

	public String getPassword() {
		return this.getString("password");
	}

	public void setPassword(String password) {
		this.set("password", password);
	}

	public String getRealName() {
		return this.getString("realName");
	}

	public void setRealName(String realName) {
		this.set("realName", realName);
	}

	public String getTitle() {
		return this.getString("title");
	}

	public void setTitle(String title) {
		this.set("title", title);
	}

	public String getBirthday() {
		return this.getString("birthday");
	}

	public void setBirthday(String birthday) {
		this.set("birthday", birthday);
	}

	public double getEmoneyExt() {
		return this.getDouble("emoneyExt");
	}

	public void setEmoneyExt(double emoneyExt) {
		this.set("emoneyExt", emoneyExt);
	}

	public String getRandom() {
		return this.getString("random");
	}

	public void setRandom(String random) {
		this.set("random", random);
	}

	public String getHomeAddress() {
		return this.getString("homeAddress");
	}

	public void setHomeAddress(String homeAddress) {
		this.set("homeAddress", homeAddress);
	}

	public String getPostalCode() {
		return this.getString("postalCode");
	}

	public void setPostalCode(String postalCode) {
		this.set("postalCode", postalCode);
	}

	public String getEmail() {
		return this.getString("email");
	}

	public void setEmail(String email) {
		this.set("email", email);
	}

	public int getHonorID() {
		return this.getInt("honorID");
	}

	public void setHonorID(int honorID) {
		this.set("honorID", honorID);
	}

	public int getUserEPoint() {
		return this.getInt("userEPoint");
	}

	public void setUserEPoint(int userEPoint) {
		this.set("userEPoint", userEPoint);
	}

	public int getParentId() {
		return this.getInt("parentId");
	}

	public void setParentId(int parentId) {
		this.set("parentId", parentId);
	}

	public int getDepartmentId() {
		return this.getInt("departmentId");
	}

	public void setDepartmentId(int departmentId) {
		this.set("departmentId", departmentId);
	}

	public int getGender() {
		return this.getInt("gender");
	}

	public void setGender(int gender) {
		this.set("gender", gender);
	}

	public int getIsUsable() {
		return this.getInt("isUsable");
	}

	public void setIsUsable(int isUsable) {
		this.set("isUsable", isUsable);
	}

	public int getIsAdmin() {
		return this.getInt("isAdmin");
	}

	public void setIsAdmin(int isAdmin) {
		this.set("isAdmin", isAdmin);
	}

	public int getRegionId() {
		return this.getInt("regionId");
	}

	public void setRegionId(int regionId) {
		this.set("regionId", regionId);
	}

	public long getEmoney() {
		return this.getLong("emoney");
	}

	public void setEmoney(long emoney) {
		this.set("emoney", emoney);
	}

	public String getMobilePhone() {
		return this.getString("mobilePhone");
	}

	public void setMobilePhone(String mobilePhone) {
		this.set("mobilePhone", mobilePhone);
	}

	public String getHomePhone() {
		return this.getString("homePhone");
	}

	public void setHomePhone(String homePhone) {
		this.set("homePhone", homePhone);
	}

	public String getOfficePhone() {
		return this.getString("officePhone");
	}

	public void setOfficePhone(String officePhone) {
		this.set("officePhone", officePhone);
	}

	public String getCity() {
		return this.getString("city");
	}

	public void setCity(String city) {
		this.set("city", city);
	}

	public String getProvince() {
		return this.getString("province");
	}

	public void setProvince(String province) {
		this.set("province", province);
	}

	public Date getCreateDate() {
		return this.getDate("createDate");
	}

	public void setCreateDate(Date createDate) {
		this.set("createDate", createDate);
	}

	public Date getLastModifiedDate() {
		return this.getDate("lastModifiedDate");
	}

	public void setLastModifiedDate(Date lastModifiedDate) {
		this.set("lastModifiedDate", lastModifiedDate);
	}

	public double getDeposit() {
		return this.getDouble("deposit");
	}

	public void setDeposit(double deposit) {
		this.set("deposit", deposit);
	}

	public double getShopDeposit() {
		return this.getDouble("shopDeposit");
	}

	public void setShopDeposit(double shopDeposit) {
		this.set("shopDeposit", shopDeposit);
	}

	public String getSpecial() {
		return this.getString("special");
	}

	public void setSpecial(String special) {
		this.set("special", special);
	}

	public boolean isShop() {
		return this.bShop;
	}

	public void setBShop(boolean bShop) {
		this.bShop = bShop;
	}

	public Date getLastLoginTime() {
		return lastLoginTime;
	}

	public void setLastLoginTime(Date lastLoginTime) {
		this.lastLoginTime = lastLoginTime;
	}

	@Override
	public String toString() {
		return JsonWrapper.writeValue(this);
	}

	public String getExpireTime() {
		return expireTime;
	}

	public void setExpireTime(String expireTime) {
		this.expireTime = expireTime;
	}
}
